<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>DisplayPosToXY Method</TITLE>
<link rel="stylesheet" type="text/css" href="help.css">
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<OBJECT TYPE="application/x-oleobject" CLASSID="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
	<PARAM NAME="Keyword" VALUE="DisplayPosToXY Method">
</OBJECT>

<H1><A NAME="displaypostoxy_method"></A><B>DisplayPosToXY Method</B></H1>
<HR>

<H2 class="AppliesTo">Applies to</H2>

<P><A HREF="thtmlviewer_component.htm">THtmlViewer</A> component</P>

<H2 class="Declaration">Declaration</H2>

<P>function DisplayPosToXY(DisplayPos: integer; var X, Y: integer): boolean;</P>

<H2 class="Description">Description</H2>

<P>Given a character position in the display, DisplayPosToXY finds the <I>X</I> and <I>Y</I> location of the character on the display.  Dimensions are in pixels relative to the upper left corner of the display.</P>

<P>DisplayPosToXY returns False if the requested position does not exist.</P>

<P><B>Example:</B></P>

<P>The following code will check to see if the selected position is within the currently displayed area  If not it will position the display to insure that it is</P>

<P>if Viewer.DisplayPosToXY(Viewer.<A HREF="selstart_property.htm">SelStart</A>, X, Y) then</P>

<P>begin</P>

<P>VPos := Viewer.<A HREF="vscrollbarposition_property.htm">VScrollBarPosition</A>;</P>

<P>if (Y &lt; VPos) or (Y &gt; VPos +Viewer.ClientHeight-20) then</P>

<P>Viewer.<A HREF="vscrollbarposition_property.htm">VScrollBarPosition</A> := (Y - Viewer.ClientHeight div 2);</P>

<P>end;</P>

<H2 class="SeeAlso">See Also:</H2>

<P><A HREF="selstart_property.htm">SelStart Property</A></P>

<P><A HREF="findsourcepos_method.htm">FindSourcePos Method</A></P>

<P><A HREF="finddisplaypos_method.htm">FindDisplayPos Method</A></P>

</BODY>
</HTML>
